@import "./var.scss";
@mixin box_width($width) {
  width: $width;
  margin: 0 auto;
}

@mixin display-grid($columns) {
  display: grid;
  grid-template-columns:repeat(auto-fit, $columns);
  flex-wrap: wrap;
}

@mixin display-grid-fr($columns-number,$gap) {
  display: grid;
  grid-template-columns: repeat($columns-number,1fr);
  gap:$gap
}


@mixin flex{
  display: flex;
  display: -webkit-flex;
}

@mixin flex-column {
  display: flex;
  display: -webkit-flex;
  flex-direction: column;
}

@mixin flex-between{
  display: flex;
  display: -webkit-flex;
  justify-content: space-between;
}

@mixin column-between {
  display: flex;
  display: -webkit-flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 文本垂直水平居中 */
@mixin flex-inline-flex {
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

@mixin flex-center($justify-content:flex-start) {
  display: flex;
  display: -webkit-flex;
  @if $justify-content {
    justify-content: $justify-content;
  }
  align-items: center;
}

/* 垂直居中 */
@mixin items-center($align-items:center) {
  display: flex;
  display: -webkit-flex;
  align-items: $align-items;
}

/* position方式垂直水平居中  */
@mixin position-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* 撑满父元素 */
@mixin full-parent-el {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
}

/* 滚动条 */
@mixin scroll-bar {
  &:hover {
    ::-webkit-scrollbar {
      height: 5px;
      width: 5px;
    }
  }
  ::-webkit-scrollbar {
    height: 0px;
    width: 0px;
    background-color: transparent;
    transition: all .5s ease-out;
  }
  ::-webkit-scrollbar-thumb {
    min-height: 30px;
    background-color: rgba(17, 31, 44, .12);
    border-radius: 22px;
  }
}
/* 多行超出显示... 默认显示2行*/
@mixin many-ellipsis($line-clamp:2) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: $line-clamp;
  overflow: hidden;
  text-overflow: ellipsis;
  /* 解决纯字母溢出隐藏失效*/
  word-break: break-all
}
/* 文字超出 中间显示... */
@mixin center-ellipsis() {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  &:before,
  &:after {
    content: '...';
  }
}

//右箭头
@mixin rigthafter {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-top: 2px solid #999;
  border-right: 2px solid #999;
  transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
}


/* 单行超出显示... */
.one-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 多行超出显示... 默认显示2行*/
.many-ellipsis {
  @include many-ellipsis;
}



@mixin clearfix {
  &:after {
    content: "";
    display: table;
    clear: both;
  }
}

@mixin scrollBar {
  &::-webkit-scrollbar-track-piece {
    background: #d3dce6;
  }

  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-thumb {
    background: #99a9bf;
    border-radius: 20px;
  }
}

@mixin relative {
  position: relative;
  width: 100%;
  height: 100%;
}

@mixin pct($pct) {
  width: #{$pct};
  position: relative;
  margin: 0 auto;
}

@mixin triangle($width, $height, $color, $direction) {
  $width: $width/2;
  $color-border-style: $height solid $color;
  $transparent-border-style: $width solid transparent;
  height: 0;
  width: 0;

  @if $direction==up {
    border-bottom: $color-border-style;
    border-left: $transparent-border-style;
    border-right: $transparent-border-style;
  }

  @else if $direction==right {
    border-left: $color-border-style;
    border-top: $transparent-border-style;
    border-bottom: $transparent-border-style;
  }

  @else if $direction==down {
    border-top: $color-border-style;
    border-left: $transparent-border-style;
    border-right: $transparent-border-style;
  }

  @else if $direction==left {
    border-right: $color-border-style;
    border-top: $transparent-border-style;
    border-bottom: $transparent-border-style;
  }
}
